package com.example.demo.service.imp;

import com.example.demo.mapper.UserMapper;
import com.example.demo.pojo.User;
import com.example.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class UserServiceImp implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public List<User> getAll() {
        return userMapper.getAll();
    }

    @Override
    @Transactional
    public void add(User user) {
        userMapper.add(user);
    }

    @Override
    @Transactional
    public void delete(Integer user_id) {
        userMapper.delete(user_id);
    }
}
